package com.ty.day5;

/**
 * Created by IntelliJ IDEA.
 *
 * @author : txy
 * @create : 2023/11/28 14:23
 */
public class ExceptionDemo02  {
    public static void main(String[] args) {
        try {
            setGGBand("GG波1");
        } catch (GGBandException e) {
            e.printStackTrace();
        }
    }
    static void setGGBand(String name) throws GGBandException {
        if (!"GG波".equalsIgnoreCase(name)){
            throw new GGBandException("GG波设置异常");
        }
        System.out.println(name+"设置成功");
    }
}
class GGBandException extends Exception{
    public GGBandException() {
        System.out.println("GG爆设置异常");
    }
    public GGBandException(String msg){
        super(msg);
    }

    @Override
    public void printStackTrace() {
//        super.printStackTrace();
        System.out.println(getMessage());
    }
}